package com.base.cn.platform.os.service.manage.function;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.manage.BaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 资源权限接口
 *
 * @author s.li
 * @create 2018-03-14 11:18
 */
@FeignClient(name = BaseService.appName,configuration = FeignAuthConfig.class)
public interface SysFunctionService extends BaseService {

    /**
     * 获取后台页面显示的权限权限
     * @param userId 用户ID
     * @return List<SysFunction> (处理后权限数据列表)
     */
    @RequestMapping(contextPath + "/findAdminPageAllFunction")
    List<Map<String,Object>> findAdminPageAllFunction(@RequestParam("userId") BigDecimal userId);

    @RequestMapping(contextPath+"/findAllCacheSysFunctionList")
    List<Map<String,Object>> findAllCacheSysFunctionList();

    @RequestMapping(contextPath+"/findUserPageRightFunctionList")
    List<Map<String,Object>> findUserPageRightFunctionList(@RequestParam("userId") BigDecimal userId,
                                                           @RequestParam("functionId") BigDecimal functionId);
    @RequestMapping(contextPath+"/findUserFunctionList")
    List<Map<String,Object>> findUserFunctionList(@RequestParam("userId") BigDecimal userId);

    @RequestMapping(contextPath+"/findSysFunctionList")
    List<Map<String,Object>> findSysFunctionList(@RequestBody Map<String, Object> sysFunctionCondition);

    @RequestMapping(contextPath+"/findLayeredUserFunctionList")
    List<Map<String,Object>> findLayeredUserFunctionList(@RequestParam("userId") BigDecimal userId);

    /**
     * 查询没有缓存用户的权限数据列表
     * @param userId 用户ID
     * @param layered 是否分成
     * @return List<SysFunction>
     */
    @RequestMapping(contextPath + "/findNotCacheUserFunctionList")
    List<Map<String,Object>> findNotCacheUserFunctionList(@RequestParam("userId") BigDecimal userId, @RequestParam("layered") boolean layered);

    @RequestMapping(contextPath+"/findAllFunctionList")
    List<Map<String,Object>> findAllFunctionList();

    @RequestMapping(contextPath+"/findSysFunctionById")
    Map<String,Object> findSysFunctionById(@RequestParam("functionId") BigDecimal functionId);

    @RequestMapping(contextPath+"/saveSysFunction")
    Map<String,Object> saveSysFunction(@RequestBody Map<String, Object> sysFunction);

    @RequestMapping(contextPath+"/deleteSysFunction")
    Map<String,Object> deleteSysFunction(@RequestParam("ids") String ids);

    @RequestMapping(contextPath+"/updateSysFunctionParent")
    Map<String,Object> updateSysFunctionParent(@RequestParam("functionId") BigDecimal functionId, @RequestParam("parentId") BigDecimal parentId);

}
